package com.usian.admin.controller;

import com.usian.admin.service.UserLoginService;
import com.usian.admin.service.WemediaNewsAutoScanService;
import com.usian.apis.admin.LoginControllerApi;
import com.usian.model.admin.dtos.AdUserDto;
import com.usian.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/login")
public class LoginController implements LoginControllerApi {
    @Autowired
    private UserLoginService userLoginService;


    @Autowired
    private WemediaNewsAutoScanService scanService;

    @RequestMapping("/in")
    @Override
    public ResponseResult login(@RequestBody AdUserDto dto) {
        return userLoginService.login(dto);
    }

    @PostMapping("/out")
    public ResponseResult logout(@RequestParam String name){
        return ResponseResult.okResult(name);
    }

    @GetMapping("/auto")
    public ResponseResult auto(Long id){
        return scanService.autoScanByMediaNewsId(id);
    }

}
